package cn.kgc.itrip.service.impl;

import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSenderImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class EmailServiceImpl implements EmailService {

    @Resource
    private JavaMailSenderImpl javaMailSender;
    @Resource
    private SimpleMailMessage simpleMailMessage;

    @Override
    public void sendToEmail(String userCode, String md5) {
        //接收的邮箱地址
        simpleMailMessage.setTo(userCode);
        //邮件内容
        simpleMailMessage.setText("爱旅行激活码:"+md5);
        //发送
        javaMailSender.send(simpleMailMessage);
    }
}
